function DataArray() {
    var _var = null,
        _arr = [];

    Object.defineProperty(this, 'val', {
        get: function () {
            return _arr
        },
        set: function (newVal) {
            _val = newVal;
            _arr.push({val: _val});
            console.log('A new value "' + _val + '" has been added to the array');
        }
    });

    this.getArr = function () {
        return _arr
    }
}

var dataArr = new DataArray();

dataArr.val = 123;
dataArr.val = 234;
console.log(dataArr.getArr());
